<!--#include file="inc/conn.asp" -->
<!--#include file="inc/Function.asp" -->
<%
Action = Request("Action")
Select Case Action
    Case "Logout"
		Response.Cookies(CookiesName)("UserName") = ""
		Response.Cookies(CookiesName)("Password") = ""
		Response.Cookies(CookiesName)("strcount") =  ""
		Response.Cookies(CookiesName)("strDate") =  ""
		Response.Cookies(CookiesName)("strUsercount") = ""
		Response.Cookies(CookiesName)("strUserDate") = ""
        Session.Abandon()
        Response.Redirect "index.asp"
    Case "Login"
        Call Login()
    Case Else
        Call main()
End Select

Sub Main    

			If (request.cookies(CookiesName)("UserName")=adminname And  request.cookies(CookiesName)("Password")=adminpass) Or  (request.cookies(CookiesName)("UserName")=adminname2 And  request.cookies(CookiesName)("Password")=adminpass2)  Or  (request.cookies(CookiesName)("UserName")=adminname3 And  request.cookies(CookiesName)("Password")=adminpass3) Then 
				Response.Redirect "Index.asp" 
			End If 

%>

<!doctype html>
<html  class="x-admin-sm">
<head>
	<meta charset="UTF-8">
	<title>后台登录-<%=ServerName%></title>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="stylesheet" href="./lib/css/font.css">
    <link rel="stylesheet" href="./lib/css/login.css">
  <link rel="stylesheet" href="./lib/css/weadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="./lib/layui/layui.js" charset="utf-8"></script>
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body class="login-bg">
    

  <div class="login layui-anim layui-anim-up">
        <div class="message"><%=ServerName%>-管理登录</div>
        <div id="darkbannerwrap"></div>
        
        <form method="post" class="layui-form" >
            <input name="Username" placeholder="用户名"  type="text" lay-verify="required" class="layui-input" >
            <hr class="hr15">
            <input name="Password" lay-verify="required" placeholder="密码"  type="password" class="layui-input">
            <hr class="hr15">
            <div class="layui-col-xs7">
              <input type="text" name="ChkCode"   placeholder="图形验证码" class="layui-input">
            </div>
            <div class="layui-col-xs5">
              <div style="margin-left: 10px;">
                <img src="https://www.oschina.net/action/user/captcha" class="layadmin-user-login-codeimg" id="LAY-user-get-vercode">
              </div>
            </div>
            <hr class="hr15">
           <input type="checkbox" name="remember" title="记住密码" checked>
            <hr class="hr15" >
            <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
        </form>
    </div>
<script>
//监听提交
layui.use('form', function(){
  var form = layui.form;
    form.on('submit(login)', function(data){
    // layer.msg(JSON.stringify(data.field));//弹出json格式所有表单的值
	//return false;
    $.ajax({
      type:"get",
       url:"login.asp?Action=Login",
	  data: data.field,
      dataType:"json",
      success:function(data){
        if(data.status=='yes'){
          layer.msg(data.msg, {icon: 1});
          //var url = "{:U('device/getinfo')}"; //成功跳转的url
          setTimeout(window.location.href='index.asp',2000);
        }else{
          layer.msg(data.msg, {icon: 2});
        }
      },
    });
	return false;
  });
});

        </script>
  
</body>
</html>

<%
End Sub

Sub login()
    Dim strUser, strPassWord,ChkCode
    strUser = Request("Username")
	strPassWord = md5(strUser&Request("Password"))
	strremember = Request("remember")
    ChkCode = Request("ChkCode")

'Response.write Request.Form("Password")
'Response.write strPassWord
'Response.end
'Response.write md5(strUser&Request.Form("Password"))

			

				If (IsForbidIP(AcceptIP) = false And Ipcheck=1)  Then  '如果不是白名单IP则进行session校验+安全码校验
						If ChkCode<>SafeCode Then response.write "{""msg"":""验证码错误!"",""status"":""no""}":response.End
				End If 

						If (strUser=adminname And  strPassWord=adminpass) Or  (strUser=adminname2 And  strPassWord=adminpass2) Or  (strUser=adminname3 And  strPassWord=adminpass3) Then 
							Response.Cookies(CookiesName)("UserName")=strUser
							Response.Cookies(CookiesName)("Password")=strPassWord

							'response.write request.cookies(CookiesName)("UserName")

							'response.write request.cookies(CookiesName)("Password")
							'response.End


									If strremember="on" Then 
										Response.Cookies(CookiesName).expires =Date+365 
									else
										Response.Cookies(CookiesName).expires=(now()+1/24) 
									End If 
							response.write "{""msg"":""登陆成功!"",""status"":""yes""}":response.End
						Else 
							response.write "{""msg"":""用户名或者密码错误!"",""status"":""no""}":response.End
						End If 






End Sub
%>
